package cn.tedu.store.service.impl;


import cn.tedu.store.entity.LisResult;
import cn.tedu.store.mapper.FuYouResultMapper;
import cn.tedu.store.mapper.JiKongResultMapper;
import cn.tedu.store.mapper.PeoPleResultMapper;
import cn.tedu.store.mapper.ZhongYiResultMapper;
import cn.tedu.store.service.LisResultService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


@Service
public class LisResultServiceImpl extends ServiceImpl<ZhongYiResultMapper, LisResult> implements LisResultService {

    @Autowired
    PeoPleResultMapper peoPleResultMapper;
    @Autowired
    ZhongYiResultMapper zhongYiResultMapper;
    @Autowired
    JiKongResultMapper jiKongResultMapper;
    @Autowired
    FuYouResultMapper fuYouResultMapper;

    @Override
    public LisResult getOneResult(String testDate, String hisItemCode,String machineCode) {

        if (peoPleResultMapper.selectExist(testDate,hisItemCode,machineCode)>=1){
            return peoPleResultMapper.getOneResult(testDate,hisItemCode,machineCode);
        }else   if (zhongYiResultMapper.selectExist(testDate,hisItemCode,machineCode)>=1){
            return zhongYiResultMapper.getOneResult(testDate,hisItemCode,machineCode);
        }else   if (jiKongResultMapper.selectExist(testDate,hisItemCode,machineCode)>=1){
            return jiKongResultMapper.getOneResult(testDate,hisItemCode,machineCode);
        }else if (fuYouResultMapper.selectExist(testDate,hisItemCode,machineCode)>=1){
            LisResult oneResult4 = fuYouResultMapper.getOneResult(testDate,hisItemCode,machineCode);

            return oneResult4;
        }
        LisResult lisResult = new LisResult();
        lisResult.setRange("无");
        lisResult.setItemcode("无");
        lisResult.setItemname("无");
        lisResult.setMemo("无");
        lisResult.setUnit("无");
        lisResult.setResult("无");
        return lisResult;
    }
}
